import java.io.*;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import javax.print.MultiDoc;

public class tb {

	
	public static void main(String[] args)	
	{
//		String text = "I will come and, * *- meet you at the woods 123woods and all the woods";
//
//	
//		String patternString = " " + "*-"+" " ;
//		Pattern pattern = Pattern.compile(patternString);
//		Matcher matcher = pattern.matcher(text);
//
//		if (matcher.find()) {
//		    System.out.println("contains");
//		}
//		else
//		{
//			System.out.println("not contains");
//			
//		}
		String str="hello new demo hello";
		String[] term = {"hello" , "new" };
		String keyword = " ";
		int []comparearray = new int [term.length];
		int compareValue = 0;
		int reVal = 0;
		Map<String,Integer> hmap= new HashMap<String,Integer>();
		for(int index = 0 ; index < term.length ; index++){
			for(String tempStr : str.split(" "))
			{
				keyword = tempStr;
				System.out.println("what's insde : " + tempStr);
				if(term[index].equalsIgnoreCase(tempStr))
				{
					reVal++;	
					hmap.put(keyword, reVal);
				}
				
		  
			}
		//comparearray[index] = reVal;
	    
		reVal = 0;
		}
		if(hmap.size() != term.length)
		{
			System.err.println("missing term");
			
		}
		String hello = hmap.get("hello").toString();
		System.err.println("what is value insde ??"  + hello);
		System.err.println(hmap);
//		for(int index2 = 0 ; index2 < comparearray.length ; index2++)
//		{
//			System.out.println("result "+ comparearray[index2]);
//			
//		}
		



		
	}
		
}
	
	
	

